import request from '@/utils/request'
const api_name = '/manage/teacher/courses'

export function saveCourse(data) {
  return request({
    url: `${api_name}`,
    method: 'post',
    data
  })
}

export function getCourseById(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'get'
  })
}

export function updateCourseById(data) {
  return request({
    url: `${api_name}/${data.courseId}`,
    method: 'put',
    data
  })
}

export function getPageList(teacherId, page, limit,searchParam) {
  return request({
    url: `${api_name}/${teacherId}/${page}/${limit}`,
    method: 'get',
    params: searchParam
  })
}

export function getCoursePublishById(id) {
  return request({
    url: `${api_name}/publish/${id}`,
    method: 'get'
  })
}

export function publishCourseById(id,status) {
  return request({
    url: `${api_name}/publish/${id}`,
    method: 'put',
    data: status
  })
}

export function deleteCourseById(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'delete'
  })
}


